package com.gking.centerSystem.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gking.centerSystem.entity.Permissions;
import com.gking.centerSystem.entity.RolePermissions;
import com.gking.centerSystem.entity.Routes;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RolePermissionsMapper extends BaseMapper<RolePermissions> {


    /**
     * 根据权限id获取权限列表
     *
     * @param ids 权限id列表
     * @return 权限列表
     */
    @Select("<script>" +
            "SELECT DISTINCT permission.* " +
            "FROM sy_permissions permission " +
            "WHERE permission.isDelete = 0 AND permission.enable = 0 " +
            "<if test='ids != null and ids.size() > 0'>" +
            "   AND permission.id IN " +
            "   <foreach collection='ids' item='item' open='(' separator=',' close=')'>" +
            "       #{item}" +
            "   </foreach>" +
            "</if>" +
            "</script>")
    List<Permissions> getPermissionsByIds(@Param("ids") List<String> ids);


}
